 {include file="public/header" /}
 <style>
     

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }
 </style>
 <body class="gray-bg">
 <div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        {include file="public/tophead" /}
        {include file="public/top" /}
        <div class="ibox-content">
        {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar loadClick">
                        <a class="btn btn-default btn-outline {eq name='state' value='0'}asdlkjasd{/eq}"  href="{:url('unpayReceipt',['state'=>'0'])}">未处理</a>
                        <a class="btn btn-default btn-outline {eq name='state' value='1'}asdlkjasd{/eq}" href="{:url('unpayReceipt',['state'=>'1'])}">已处理</a>
                    </div>
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="" style="display: flex;">
                            <div class="pull-left search" style="display: flex;">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search">
                                        <option value="numbers" {php}if(input('?param.search')){if(input('param.search')=='numbers'){echo "selected";} }{/php}>订单号</option>
                                    </select>
                                </div>

                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                           {php}
                                           if(input('?param.name')){
                                    if(input('param.name')){
                                    echo "value='".input('name')."'";
                                    }

                                    }
                                    {/php}
                                    name="name" placeholder="输入订单号">
                                </div>

                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>

                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('unpayReceipt')}">返回列表</a>
                                </div>{php}
                                }
                                {/php}
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <table data-toggle="table" data-striped="false">
                            <thead>
                                <tr>
                                    <th>订单号</th>
                                    <th>支付方式</th>
                                    <th>价格</th>
                                    <th>金币</th>
                                    <th>用户id</th>
                                    <th>用户昵称</th>
                                    <th>创建时间</th>
                                    <th>支付时间</th>
                                    <th>检测时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td>
                                        <a onclick="topup('{$v.numbers}')" style="color:#40BCF7">{$v.numbers}</a>
                                    </td>
                                    <td>{if condition="$v.type == 0"}微信{elseif condition="$v.type == 1"}支付宝{/if}</td>
                                    <td>{$v.price}</td>
                                    <td>{$v.money}</td>
                                    <td>{$v.fk_userid}</td>
                                    <td>
                                        {php}
                                        $user = _user_cache($v['fk_userid']);
                                        {/php}
                                        <a onclick="member('{$v.fk_userid}')" style="color:#40BCF7">{$user['name']}</a>
                                    </td>
                                    <td>{$v.addtime}</td>
                                    <td>{$v.pay_time|date='Y-m-d H:i:s',###}</td>
                                    <td>{$v.create_time|date='Y-m-d H:i:s',###}</td>
                                <td>
                                            {eq name="v.state" value="0"}
                                            <a class="btn btn-primary btn-xs dropdown-toggle" onClick="setState({$v.id}, 1)">设为已处理</a>
                                            {/eq}
                                            {eq name="v.state" value="1"}
                                            <a class="btn btn-primary btn-xs dropdown-toggle" onClick="setState({$v.id}, 0)">设为未处理</a>
                                            {/eq}
                                </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>  
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{load href="__PLUGINS__layui/layui.js"}
<script type="text/javascript">
    
    function topup(numbers)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("member/topup")}?search=numbers&name='+numbers
            });
        });
    }
    
    function member(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("member/index")}?search=id&name='+id
            });
        });
    }
    function setState(id, state) {
        $.ajax({
            type: 'POST',
            url: "{:url('admin/Topup/setState')}",
            data: {id, state},
            dataType: 'json',
            success: function (date) {
                if (date.state) {
                    layer.msg(date.msg, {icon: 1});
                    setTimeout(()=>{
                        window.location.reload();
                    }, 1000)
                } else {
                    layer.msg(date.msg, {icon: 0});
                }
            },
            error: function (e) {
                layer.msg(e.responseText);
            }
        });
    }
</script>
{include file="public/footer" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}